import http from '../utils/http';

// 参数接口
export interface LoginParams {
  code?: string;
  password?: string;
  username?: string;
  uuid?: string;
}

// 响应接口
export interface LoginRes {}

/** 
 * 登录
 * @param {object} params loginBody
 * @param {string} params.code 
 * @param {string} params.password 
 * @param {string} params.username 
 * @param {string} params.uuid 
 * @returns
 */
export function loginIn(params: LoginParams): Promise<LoginRes> {
  return http(`/admin/login`, 'POST', params);
}

// 响应接口
export interface GetCodeRes {}

/** 
 * 获取验证码
 * @returns
 */
export function getCaptchaImage(): Promise<GetCodeRes> {
  return http(`/admin/captchaImage`, 'GET');
}
// 响应接口
export interface GetInfoRes {}

/** 
 * 获取用户信息
 * @returns
 */
export function getInfo(): Promise<GetInfoRes> {
  return http(`/admin/getInfo`, 'GET');
}

// 响应接口
export interface SelectCmsStatisticsRes {
  code: number;
  data: {
    chargingAmount: number;
    deviceNum: number;
  };
  msg: string;
}

/** 
 * 大屏首页
 * @returns
 */
export function selectCmsStatistics(): Promise<SelectCmsStatisticsRes> {
  return http(`/admin/unauth/fictitious/index`, 'GET');
}



// 参数接口
export interface SelectCmsOrderPageParams {
  endTime?: string;
  mobile?: string;
  orderId?: number;
  productName?: string;
  startTime?: string;
  userId?: number;
  ypageNum?: number;
  ypageSize?: number;
}

// 响应接口
export interface SelectCmsOrderPageRes {
  code: number;
  msg: string;
  pageNum: number;
  pageSize: number;
  rows: {
    avatar: string;
    createTime: string;
    deviceNum: number;
    hasReward: number;
    hasRewardStr: string;
    mallProductVo: {
      categoryId: number;
      categoryName: string;
      details: string;
      deviceNum: number;
      discountPrice: number;
      id: number;
      oriPrice: number;
      productMainPic: string;
      productName: string;
    };
    mobile: string;
    num: number;
    orderId: number;
    orderStatus: number;
    orderStatusStr: string;
    oriPrice: number;
    payPrice: number;
    productDetail: string;
    productId: number;
    productName: string;
    userId: number;
  }[];
  total: number;
}

/** 
 * 商品订单分页查询
 * @param {object} params 商城订单分页查询
 * @param {string} params.endTime 截止时间: yyyy-mm-dd hh:mm:ss
 * @param {string} params.mobile 用户手机号
 * @param {number} params.orderId 主键
 * @param {string} params.productName 产品名称
 * @param {string} params.startTime 开始时间: yyyy-mm-dd hh:mm:ss
 * @param {number} params.userId 用户Id
 * @param {number} params.ypageNum 
 * @param {number} params.ypageSize 
 * @returns
 */
// export function selectCmsOrderPage(params: SelectCmsOrderPageParams): Promise<SelectCmsOrderPageRes> {
//   return http(`/admin/mall/order/list`, 'POST', params);
// }
export function selectFictitiousOrderPage(params: SelectCmsOrderPageParams): Promise<SelectCmsOrderPageRes> {
  return http(`/admin/unauth/fictitious/orderList`, 'POST', params);
}


/** 
 * 大屏首页
 * @returns
 * activateDeviceCount	激活设备数量	integer(int32)	 
 * activateOfflineDeviceCount	激活离线设备数量	integer(int32)	 
 * activateOnlineDeviceCount	激活在线设备数控	integer(int32)	 
 * deviceCount	全部设备数量	integer(int32)	 
 * levelFourCount	四级经销商数量	integer(int32)	 
 * levelOneCount	一级经销商数量	integer(int32)	 
 * levelThreeCount	三级经销商数量	integer(int32)	 
 * levelTwoCount	二级经销商数量	integer(int32)	 
 * todayOrderAmount	今日订单金额	number	 
 * totalOrderAmount	订单总金额
 */
export function selectCmsOrderPage(): Promise<any> {
  return http(`/admin/unauth/fictitious/index`, 'GET');
}

// 获取订单统计
export function getDpFictitiousStatistics(): Promise<any> {
  return http(`/admin/unauth/fictitious/getDpFictitiousStatistics`, 'GET');
}
